package algorithms.roughgarden.part2.jobsceduler;

import java.util.Comparator;

public class JobRatioComparator implements Comparator<Job> {

	public int compare(Job job1, Job job2) {
		float ratio1 = job1.getWeight()*1.0f/job1.getLength();
		float ratio2 = job2.getWeight()*1.0f/job2.getLength();
		int job1HigherPriority=1;
		if(ratio2>ratio1){
			job1HigherPriority = -1;
		}
		return job1HigherPriority;
	}

}
